package com.zzx.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.zzx.entity.TGx;
import com.zzx.service.TGxService;
import com.zzx.entity.ApiResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 工序表 控制器
 *
 * @author zzx
 * @since 2025-06-14
 */

@Api(tags = "工序表 模块管理")
@RestController
@RequestMapping("/tGx")
public class TGxController {

    @Resource
    private TGxService tGxService;

    @ApiOperation(value = "新增、编辑")
    @PostMapping("/add")
    public ApiResult add(@RequestBody TGx param) {
        tGxService.add(param);
        return ApiResult.ok();
    }

    @ApiOperation(value = "列表查询")
    @PostMapping("/selectBy")
    public ApiResult selectBy(@RequestBody TGx param) {
        return ApiResult.ok(tGxService.selectBy(param));
    }

    @ApiOperation("根据ID获取详情")
    @GetMapping("/{id}")
    public ApiResult getById(@PathVariable("id") String id) {
        return ApiResult.ok(tGxService.findById(id));
    }

    @ApiOperation(value = "删除")
    @PostMapping("/deleteById")
    public ApiResult deleteById(@RequestBody TGx param) {
        tGxService.deleteById(param);
        return ApiResult.ok();
    }
}
